from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles

from app.api.docs import docs
from app.api.v1 import routor
from app.config import settings
from app.core.lifespan import lifespan
from app.core.middlewares.handle import handle_middleware


def start_app() -> FastAPI:
    app = FastAPI(
        lifespan=lifespan,
        debug=True,
        docs_url=None,
        redoc_url=None,
        title=settings.TITLE,
        version=settings.API_VERSION,
        openapi_tags=routor.openapi_tags
    )

    handle_middleware(app)

    app.mount("/static", StaticFiles(directory="static"), name="static")

    app.include_router(docs.router)

    app.include_router(routor.router)

    return app
